<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QGraphicsTransform Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGraphicsTransform Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGraphicsTransform class is an abstract base class for
building advanced transformations on QGraphicsItems. <a href="#details">More...</a></p>

<p>Inherits <a href="qobject.html">QObject</a>.</p><p>Inherited by <a href="qgraphicsrotation.html">QGraphicsRotation</a> and <a href="qgraphicsscale.html">QGraphicsScale</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgraphicstransform.html#QGraphicsTransform">__init__</a></b> (<i>self</i>, QObject&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qgraphicstransform.html#applyTo">applyTo</a></b> (<i>self</i>, QMatrix4x4&#160;<i>matrix</i>)</li><li><div class="fn" /><b><a href="qgraphicstransform.html#update">update</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGraphicsTransform class is an abstract base class for
building advanced transformations on QGraphicsItems.</p>
<p>As an alternative to QGraphicsItem.transform,
QGraphicsTransform lets you create and control advanced
transformations that can be configured independently using
specialized properties.</p>
<p><a href="qgraphicsitem.html">QGraphicsItem</a> allows you to
assign any number of QGraphicsTransform instances to one <a href="qgraphicsitem.html">QGraphicsItem</a>. Each QGraphicsTransform is
applied in order, one at a time, to the <a href="qgraphicsitem.html">QGraphicsItem</a> it's assigned to.</p>
<p>QGraphicsTransform is particularly useful for animations.
Whereas <a href="qgraphicsitem.html#setTransform">QGraphicsItem.setTransform</a>()
lets you assign any transform directly to an item, there is no
direct way to interpolate between two different transformations
(e.g., when transitioning between two states, each for which the
item has a different arbitrary transform assigned). Using
QGraphicsTransform you can interpolate the property values of each
independent transformation. The resulting operation is then
combined into a single transform which is applied to <a href="qgraphicsitem.html">QGraphicsItem</a>.</p>
<p>Transformations are computed in true 3D space using <a href="qmatrix4x4.html">QMatrix4x4</a>. When the transformation is
applied to a <a href="qgraphicsitem.html">QGraphicsItem</a>, it
will be projected back to a 2D <a href="qtransform.html">QTransform</a>. When multiple QGraphicsTransform
objects are applied to a <a href="qgraphicsitem.html">QGraphicsItem</a>, all of the transformations
are computed in true 3D space, with the projection back to 2D only
occurring after the last QGraphicsTransform is applied. The
exception to this is <a href="qgraphicsrotation.html">QGraphicsRotation</a>, which projects back
to 2D after each rotation to preserve the perspective effect around
the X and Y axes.</p>
<p>If you want to create your own configurable transformation, you
can create a subclass of QGraphicsTransform (or any or the existing
subclasses), and reimplement the pure virtual <a href="qgraphicstransform.html#applyTo">applyTo</a>() function, which
takes a pointer to a <a href="qmatrix4x4.html">QMatrix4x4</a>. Each
operation you would like to apply should be exposed as properties
(e.g., customTransform-&gt;setVerticalShear(2.5)). Inside you
reimplementation of <a href="qgraphicstransform.html#applyTo">applyTo</a>(), you can modify the
provided transform respectively.</p>
<p>QGraphicsTransform can be used together with <a href="qgraphicsitem.html#setTransform">QGraphicsItem.setTransform</a>(),
<a href="qgraphicsitem.html#setRotation">QGraphicsItem.setRotation</a>(),
and <a href="qgraphicsitem.html#setScale">QGraphicsItem.setScale</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGraphicsTransform" />QGraphicsTransform.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new <a href="qgraphicstransform.html">QGraphicsTransform</a> with the given
<i>parent</i>.</p>


<h3 class="fn"><a name="applyTo" />QGraphicsTransform.applyTo (<i>self</i>, <a href="qmatrix4x4.html">QMatrix4x4</a>&#160;<i>matrix</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This pure virtual method has to be reimplemented in derived
classes.</p>
<p>It applies this transformation to <i>matrix</i>.</p>
<p><b>See also</b> <a href="qgraphicsitem.html#transform">QGraphicsItem.transform</a>() and
<a href="qmatrix4x4.html#toTransform">QMatrix4x4.toTransform</a>().</p>


<h3 class="fn"><a name="update" />QGraphicsTransform.update (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void update()</tt>.</p><p>Notifies that this transform operation has changed its
parameters in such a way that <a href="qgraphicstransform.html#applyTo">applyTo</a>() will return a
different result than before.</p>
<p>When implementing you own custom graphics transform, you must
call this function every time you change a parameter, to let
<a href="qgraphicsitem.html">QGraphicsItem</a> know that its
transformation needs to be updated.</p>
<p><b>See also</b> <a href="qgraphicstransform.html#applyTo">applyTo</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.9.5-9eb6aac99275 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.3</td></tr></table></div></address></body></html>